package com.tjp.eight.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;

import com.tjp.eight.base.BasePresenterImpl;


/**
 * Created by Administrator on 2017/2/13.
 */

public abstract class BaseFragment<P extends BasePresenterImpl> extends Fragment {
    public View contentView;
    public P presenter;

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        presenter = createPresenter();
    }

    protected abstract P createPresenter();

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (presenter != null){
            presenter.detachView();
        }
    }
}
